package Thread;

public class ThreadDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName()+":"+i);
            /*
            try {
                sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            */
        }
    }

    public static void main(String[] args) {
        ThreadDemo t1 = new ThreadDemo();
        ThreadDemo t2 = new ThreadDemo();

        /*
        t1.setPriority(10);
        t2.setPriority(1);
        */

        t1.setName("plane");

        t2.setName("car");
        t1.setDaemon(true);
        t2.setDaemon(true);
        t1.start();

        /*
        try {
            t1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        */
        Thread.currentThread().setName("people");

        t2.start();



        for (int i = 0; i < 9; i++) {
            System.out.println(Thread.currentThread().getName()+":"+i);
        }

    }
}
